package com.shijimo.server.enums;

/**
 * @author Dream_飞翔
 * @date 2021/11/25
 * @time 20:43
 * @email 1072876976@qq.com
 */
public enum FileUseEnum {

    COURSE("C", "课程"),
    TEACHER("T", "讲师");

    private String code;
    private String desc;

    FileUseEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    /**
     * 根据code得到枚举类型
     *
     * @param code
     * @return
     */
    public static FileUseEnum getByCode(String code) {
        for (FileUseEnum value : FileUseEnum.values()) {
            if (code.equals(value.getCode())) {
                return value;
            }
        }
        return null;
    }
}
